<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="java.util.HashMap"%>
<%@page import="com.bdqn.wx.entity.User"%>
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!-- 引入JSTL标签 -->    
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>




<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页</title>
</head>
<body>
 <h2>首页</h2>
 
<%
    Map names = new HashMap();
    names.put("one","LiYang");
    names.put("two","WangHua");
    request.setAttribute("names",names);
%>
姓名：${names.one}<br/>
姓名：${names["two"]}<br/>


 
<%
   User user=new User();
   user.setName("hello");
   user.setPass("8888");
   
   User user2=new User();
   user2.setName("hello2");
   user2.setPass("6666");
   
     List<User> list1=new ArrayList<User>();
     list1.add(user);
     list1.add(user2); 
/*   
    List<String> list=new ArrayList<String>();
    list.add("");
    list.add("");
    */
   request.setAttribute("userlist",list1);
   
%> 


${userlist[0].name}<br>
${userlist[0].pass}<br>

<span style="color:blue;font:22px; ">循环遍历出list集合中元素的值</span>
 <c:forEach var="useritem" items="${requestScope.userlist}">
       <h1>${useritem.name}</h1>
       <h1>${useritem.pass}</h1>
 </c:forEach>


<%
User user3=new User();
user3.setName("hello3");
user3.setPass("aaaa");

User user4=new User();
user4.setName("hello4");
user4.setPass("bbbb");

Map<String,User> map=new HashMap<String,User>();
map.put("1", user3);
map.put("2", user4);

request.setAttribute("mymap", map);

%>


<span style="color:red;font:22px; ">循环遍历出map集合中元素的值</span><br>
<c:forEach items="${mymap}" var="element">

    ${element.value.name}
    ${element.value.pass}<br>

</c:forEach>

test message: ${name}

imgSrc: <img src="${pageContext.request.contextPath}/${imgSrc}"/>


   <input type="text" id="name">
   <input type="submit" value="确定" id="btn">
   
   
   
   <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.11.3.min.js"></script>
   <script type="text/javascript">
    
   $(function(){
	   
	   $("#btn").click(function(){
 		   
			$.ajax({
				url:'/user/index',
			    type:'post',
			    data: $("#name").val(),
			    datatype:'json',
			    success:function(result){
			    	result
			  
			    }
			 
		   
	   })
	   
   })
   
   
   </script>
   
 

	

</body>
</html>